package com.github.grpc.server.property;

import lombok.Data;
import org.springframework.boot.context.properties.ConfigurationProperties;


@Data
@ConfigurationProperties("grpc.server")
public class GrpcServerProperties {
    /**
     * Server port to listen on. Defaults to 9090.
     */
    private int port = 9090;

    /**
     * Bind address for the server. Defaults to 0.0.0.0.
     */
    private String address = "0.0.0.0";

    /**
     * Bind server name for server. Defaults to gRpc.
     */
    private String name = "gRpc";

    /**
     * Bind server path to Etcd. Default to /gRpc/server
     */
    private String path = "/gRpc/server";

    /**
     * Register server to Etcd. Defaults to false
     */
    private boolean register = false;

    /**
     * The maximum message size allowed to be received for the server.
     */
    private int maxMessageSize;

    /**
     * Security options for transport security. Defaults to disabled.
     */
    private final Security security = new Security();

    @Data
    public static class Security {

        /**
         * Flag that controls whether transport security is used
         */
        private Boolean enabled = false;

        /**
         * Path to SSL certificate chain
         */
        private String key = "";

        /**
         * Path to SSL certificate
         */
        private String cert = "";

    }

}
